package com.du.integration.server.controller;

import com.du.common.base.model.ResBean;
import com.du.integration.server.enums.MqttResultEnum;
import com.du.integration.server.model.entity.MqttAuthParam;
import com.du.integration.server.model.entity.MqttAuthRes;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Desc :
 * @Author: shuangdu
 * @date : 2024/1/5
 */
@RestController
@RequestMapping(value = "auth")
@Slf4j
public class AuthController {


    @PostMapping(value = "/mqtt")
    public MqttAuthRes mqttAuth(@RequestBody MqttAuthParam param) {
        log.info("mqtt认证 {}", param);
        // param参数为服务端接口返回
        // username：username
        // password：token
        // client: md5(token)
        MqttAuthRes res = new MqttAuthRes();
        res.setResult(MqttResultEnum.ALLOW.val);
        return res;
    }

}
